package com.example.yskjproject.model;

import android.os.Parcel;
import android.os.Parcelable;

import java.util.ArrayList;
import java.util.List;

public class WithDrawalRecordListModel implements Parcelable {
    private List<WithDrawalRecordModel> list;
    private int total;

    public WithDrawalRecordListModel(List<WithDrawalRecordModel> list, int total) {
        this.list = list;
        this.total = total;
    }

    protected WithDrawalRecordListModel(Parcel in) {
        list = new ArrayList<>();
        in.readList(list, WithDrawalRecordModel.class.getClassLoader());
        total = in.readInt();
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeList(list);
        dest.writeInt(total);
    }

    @Override
    public int describeContents() {
        return 0;
    }

    public static final Creator<WithDrawalRecordListModel> CREATOR = new Creator<WithDrawalRecordListModel>() {
        @Override
        public WithDrawalRecordListModel createFromParcel(Parcel in) {
            return new WithDrawalRecordListModel(in);
        }

        @Override
        public WithDrawalRecordListModel[] newArray(int size) {
            return new WithDrawalRecordListModel[size];
        }
    };

    // Getters 和 Setters
    public List<WithDrawalRecordModel> getList() { return list; }
    public int getTotal() { return total; }
}
